package com.quick.develop.flowable.controller.schedule;

import com.quick.develop.framework.common.page.R;
import com.quick.develop.flowable.schedule.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author junyuan.liu
 * @description:
 * @date 2022/9/8 9:45
 */
@Api(tags = "流程管理后台 - 定时任务")
@RestController
@RequestMapping("/schedule")
@Validated
public class BpmScheduleController {
    @Resource
    BpmResolveEntrustTask bpmResolveEntrustTask;
    
    @Resource
    BpmVariableCleanUp bpmVariableCleanUp;
    
    @Resource
    BpmAutoCompleteReadTask bpmAutoCompleteReadTask;

    @Resource
    BpmComplementHisTask bpmComplementHisTask;

    @ApiOperation(value = "委托任务释放")
    @PostMapping("/release-entrust-task")
    public R<?> releaseEntrustTask() {
        bpmResolveEntrustTask.execute();
        return R.ok();
    }

    @ApiOperation(value = "清理历史流程参数")
    @PostMapping("/clean-up-his-variable")
    public R<Void> cleanUpHisVariable() {
        bpmVariableCleanUp.execute();
        return R.ok();
    }
    
    @ApiOperation(value = "自动已阅")
    @PostMapping("/auto-complete-read-task")
    public R<Void> autoCompleteReadTask() {
        bpmAutoCompleteReadTask.execute();
        return R.ok();
    }

    @ApiOperation(value = "已办任务数据补全")
    @PostMapping("/complement-his-task")
    public R<Void> complementHisTask() {
        bpmComplementHisTask.execute();
        return R.ok();
    }
}
